package vista;

import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.ComboBoxModel;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import clasesCreadas.JPanelImagen;
import com.toedter.calendar.JDateChooser;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaConsultarClientes extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	private JButton btnLimpiar;
	private JButton btnEliminar;
	private JButton btnBuscar;
	private JButton btnSalir;
	private JTable tblItemProductos;
	private JLabel lblTotal;
	private JTextField txtAbono;
	private ButtonGroup btgFacturado;
	private JLabel lblFacturado;
	private JRadioButton rbFacturadoNo;
	private JRadioButton rbFacturadoSi;
	private JLabel lblAbono;
	private JPanel pnlAbono;
	private JLabel lblEstatusProducto;
	private JComboBox cmbEstatusProductos;
	private JLabel lblHasta;
	private JLabel lblDesde;
	private JDateChooser dtcHasta;
	private JDateChooser dtcDesde;
	private JLabel lblTotalFloat;
	private JList listBusqueda;
	private JButton btnAgregar;
	private JScrollPane scpItemProductos;
	private JScrollPane spItemBusqueda;
	private JTextField txtCliente;
	private JLabel lblCliente;
	private JButton btnGuardar;
	private JPanelImagen pnlimagen2;
	private DefaultListModel modeloItemProducto=new DefaultListModel();

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaConsultarClientes inst = new VentanaConsultarClientes();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VentanaConsultarClientes() {
		super(" Consultar Cliente                                                         Copy David C.A J-29901186-0");
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setResizable(false);
			{
				pnlimagen2 = new JPanelImagen("pantalla.jpg");
				getContentPane().add(pnlimagen2, BorderLayout.NORTH);
				pnlimagen2.setLayout(null);
				//pnlimagen2.setBounds(10, 15, 150, 95);
				pnlimagen2.setPreferredSize(new java.awt.Dimension(699, 740));
				pnlimagen2.setBackground(new java.awt.Color(77,77,77));
				{
					btnGuardar = new VJButtonImg("","Guardar   F2");
					pnlimagen2.add(btnGuardar);
					btnGuardar.setBounds(98, 599, 93, 44);
					btnGuardar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/Guardar.png")));
				}
				{
					btnLimpiar = new VJButtonImg("","limpiar   F8");
					pnlimagen2.add(btnLimpiar);
					btnLimpiar.setBounds(234, 599, 93, 44);
					btnLimpiar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/Borrar.png")));
				}
				{
					btnSalir = new VJButtonImg("","Salir   F10");
					pnlimagen2.add(btnSalir);
					btnSalir.setBounds(511, 599, 93, 44);
					btnSalir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/Salir.png")));
				}
				{
					btnBuscar = new VJButtonImg("","Buscar");
					pnlimagen2.add(btnBuscar);
					btnBuscar.setBounds(565, 44, 81, 41);
					btnBuscar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/Buscar.png")));
				}
				{
					btnEliminar = new VJButtonImg("","Eliminar   F12");
					pnlimagen2.add(btnEliminar);
					btnEliminar.setBounds(371, 599, 93, 44);
					btnEliminar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/Eliminar.png")));
				}
				{
					lblCliente = new JLabel();
					lblCliente.setText("Cliente");
					lblCliente.setBounds(248, 53, 56, 16);
					pnlimagen2.add(lblCliente);	
				}
				{
					txtCliente = new JTextField();
					txtCliente.setBounds(310, 44, 228, 35);
					pnlimagen2.add(txtCliente);	
				}
				{
					spItemBusqueda = new JScrollPane();
					spItemBusqueda.setBounds(309, 77, 228, 111);
					pnlimagen2.add(spItemBusqueda);
					spItemBusqueda.setVisible(false);
					{
						ListModel listBusquedaModel = 
								new DefaultComboBoxModel(
										new String[] { });
						listBusqueda = new JList();
						pnlimagen2.add(listBusqueda);
						listBusqueda.setModel(listBusquedaModel);
						listBusqueda.setBounds(360, 79, 217, 35);
					}
					spItemBusqueda.setViewportView(listBusqueda);
					listBusqueda.setVisible(false);
				}
				{
					scpItemProductos = new JScrollPane();
					scpItemProductos.setBounds(58, 241, 546, 154);
					pnlimagen2.add(scpItemProductos);
					{
						TableModel tblItemProductosModel = 
								new DefaultTableModel(
										new String[][] { },
										new String[] { "Producto","Cantidad","Sub-total","Fecha","Estatus" });
						tblItemProductos = new JTable();
						tblItemProductos.setModel(tblItemProductosModel);
					}
					scpItemProductos.setViewportView(tblItemProductos);
					//scpItemProductos.setForeground(new java.awt.Color(255,255,255));
					scpItemProductos.setBackground(new java.awt.Color(247,235,235));
					tblItemProductos.setBackground(new java.awt.Color(247,235,235));
					//scpItemProductos.setBackground(new java.awt.Color(255,255,255));
				}
				{
					btnAgregar = new VJButtonImg("","aceptar   F4");
					btnAgregar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Iconos/aceptar.jpg")));
					btnAgregar.setBounds(616, 255, 71, 43);
					pnlimagen2.add(btnAgregar);
				}
					{
						lblTotal = new JLabel();
						pnlimagen2.add(lblTotal);
						lblTotal.setText("Total:");
						lblTotal.setBounds(327, 459, 78, 18);
						lblTotal.setForeground(new java.awt.Color(255,0,0));
						lblTotal.setFont(new java.awt.Font("Nimbus Mono L",3,20));
					}
					{
						lblTotalFloat = new JLabel();
						pnlimagen2.add(lblTotalFloat);
						lblTotalFloat.setText("0.00");
						lblTotalFloat.setBounds(405, 459, 65, 18);
						lblTotalFloat.setFont(new java.awt.Font("Bitstream Charter",0,14));
					}
					{
						dtcDesde = new JDateChooser();
						pnlimagen2.add(dtcDesde);
						dtcDesde.setBounds(174, 179, 178, 27);
					}
					{
						dtcHasta = new JDateChooser();
						pnlimagen2.add(dtcHasta);
						dtcHasta.setBounds(445, 179, 177, 27);
					}
					{
						lblDesde = new JLabel();
						pnlimagen2.add(lblDesde);
						lblDesde.setText("Desde");
						lblDesde.setBounds(230, 158, 55, 15);
					}
					{
						lblHasta = new JLabel();
						pnlimagen2.add(lblHasta);
						lblHasta.setText("Hasta");
						lblHasta.setBounds(500, 158, 52, 15);
					}
					{
						ComboBoxModel cmbEstatusProductosModel = 
								new DefaultComboBoxModel(
										new String[] { "Seleccione", "Credito", "No Facturado","Cred. y No Fact." });
						cmbEstatusProductos = new JComboBox();
						pnlimagen2.add(cmbEstatusProductos);
						cmbEstatusProductos.setModel(cmbEstatusProductosModel);
						cmbEstatusProductos.setBounds(358, 109, 137, 31);
					}
					{
						lblEstatusProducto = new JLabel();
						pnlimagen2.add(lblEstatusProducto);
						lblEstatusProducto.setText("Estatus");
						lblEstatusProducto.setBounds(296, 116, 68, 17);
					}
					{
						pnlAbono = new JPanel();
						pnlimagen2.add(pnlAbono);
						pnlAbono.setBounds(64, 419, 257, 116);
						pnlAbono.setLayout(null);
						pnlAbono.setBorder(BorderFactory.createTitledBorder(""));
						pnlAbono.setBackground(new java.awt.Color(247,235,235));
						{
							txtAbono = new JTextField();
							pnlAbono.add(txtAbono);
							txtAbono.setBounds(109, 10, 118, 32);
							txtAbono.addKeyListener(new KeyAdapter() {
								 public void keyTyped(KeyEvent e){
						              char carater = e.getKeyChar();
						              final String tx = txtAbono.getText().toString();
						             if((!(carater >= KeyEvent.VK_0 && carater<=KeyEvent.VK_9)) && (!(carater == KeyEvent.VK_PERIOD && tx.indexOf(".") == -1) )){
						               e.consume();
						            }
						           
						             
						             }
						            } );
						}
						{
							lblAbono = new JLabel();
							pnlAbono.add(lblAbono);
							lblAbono.setText("Abono");
							lblAbono.setBounds(54, 16, 49, 19);
						}
						{
							rbFacturadoSi = new JRadioButton();
							pnlAbono.add(rbFacturadoSi);
							rbFacturadoSi.setText("Si");
							rbFacturadoSi.setBounds(132, 65, 44, 18);
							getBtgFacturado().add(rbFacturadoSi);
						}
						{
							rbFacturadoNo = new JRadioButton();
							pnlAbono.add(rbFacturadoNo);
							rbFacturadoNo.setText("No");
							rbFacturadoNo.setBounds(182, 65, 43, 18);
							getBtgFacturado().add(rbFacturadoNo);
						}
						{
							lblFacturado = new JLabel();
							pnlAbono.add(lblFacturado);
							lblFacturado.setText("Facturado");
							lblFacturado.setBounds(52, 67, 80, 15);
						}
					}
			}
			pack();
			this.setSize(709, 769);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private ButtonGroup getBtgFacturado() {
		if(btgFacturado == null) {
			btgFacturado = new ButtonGroup();
		}
		return btgFacturado;
	}

}
